﻿using System;
using System.Data;

namespace ZhimeiSoft.CharmManager.DOL
{
    public class DBEntityServiceItem : DBEntityBase
    {
        public override string GetTableName()
        {
            return "SERVICEITEM";
        }
        public DBEntityServiceItem()
            : base()
        {
        }

        public DBEntityServiceItem(DataRow drRow)
        {
            this.SERVICEITEMID = Convert.ToInt32(drRow[DBEntityServiceItem.FieldName.SERVICEITEMID]);
	        this.SNAME = drRow[DBEntityServiceItem.FieldName.SNAME].ToString();
	        this.SCATEGORYID = Convert.ToInt32(drRow[DBEntityServiceItem.FieldName.SCATEGORYID]);
	        this.SPRICE = Convert.ToDecimal(drRow[DBEntityServiceItem.FieldName.SPRICE]);
	        this.STIMESPAN = Convert.ToInt32(drRow[DBEntityServiceItem.FieldName.STIMESPAN]);
            this.STATE = drRow[DBEntityServiceItem.FieldName.STATE].ToString();
	        this.SCALLBACKFLAG = Convert.ToInt32(drRow[DBEntityServiceItem.FieldName.SCALLBACKFLAG]);
	        this.SCALLBACKDAY = Convert.ToInt32(drRow[DBEntityServiceItem.FieldName.SCALLBACKDAY]);
            this.STARTDATE = Convert.ToDateTime(drRow[DBEntityServiceItem.FieldName.STARTDATE]);
	        this.SENDDATE = Convert.ToDateTime(drRow[DBEntityServiceItem.FieldName.SENDDATE]);
            this.SREMARK = drRow[DBEntityServiceItem.FieldName.SREMARK].ToString();
            this.SAVAILABLEDAYS = Convert.ToInt32(drRow[DBEntityServiceItem.FieldName.SAVAILABLEDAYS]);
            this.SINDEXCODE = drRow[DBEntityServiceItem.FieldName.SINDEXCODE].ToString();
            this.SERVICEITEMCODE = drRow[DBEntityServiceItem.FieldName.SERVICEITEMCODE].ToString();
            object objCount = drRow[DBEntityServiceItem.FieldName.SCOUNT];
            if (objCount != null && objCount != DBNull.Value)
                this.SCOUNT = Convert.ToInt32(drRow[DBEntityServiceItem.FieldName.SCOUNT]);
        }
        /// <summary>
        /// 服务项目ID
        /// </summary>
        public int SERVICEITEMID { get; set; }
        /// <summary>
        /// 项目名称
        /// </summary>
        public string SNAME { get; set; }
        /// <summary>
        /// 所属类别id
        /// </summary>
        public int SCATEGORYID { get; set; }
        /// <summary>
        /// 单价
        /// </summary>
        public decimal SPRICE { get; set; }
        /// <summary>
        /// 服务时间(分钟)
        /// </summary>
        public int STIMESPAN { get; set; }
        /// <summary>
        /// 服务项目状态，COA表示有效，COS表示无效
        /// </summary>
        public string STATE { get; set; }
        /// <summary>
        /// 是否需要回访
        /// </summary>
        public int SCALLBACKFLAG {get ;set;}
        /// <summary>
        /// 几天后回访
        /// </summary>
        public int SCALLBACKDAY { get; set; }
        /// <summary>
        /// 服务项目有效期开始时间
        /// </summary>
        public DateTime STARTDATE { get; set; }
        /// <summary>
        /// 服务项目有效期结束时间
        /// </summary>
        public DateTime SENDDATE { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string SREMARK { get; set; }
        /// <summary>
        /// 有效服务天数 -1 为永久有效 否则就是第一次护理开始计算加当前的天数即时服务有效期
        /// </summary>
        public int SAVAILABLEDAYS{get; set;}
        /// <summary>
        /// 快速定位码
        /// </summary>
        public string SINDEXCODE { get; set; }

        /// <summary>
        /// 服务项目编码
        /// </summary>
        public string SERVICEITEMCODE { get; set; }

        public int SCOUNT { get; set; }

        /// <summary>
        /// 字段名称
        /// </summary>
        public static class FieldName
        {
            /// <summary>
            /// 服务项目ID
            /// </summary>
            public const string SERVICEITEMID = "SERVICEITEMID";
            /// <summary>
            /// 项目名称
            /// </summary>
            public const string SNAME = "SNAME";
            /// <summary>
            /// 所属类别id
            /// </summary>
            public const string SCATEGORYID = "SCATEGORYID";
            /// <summary>
            /// 单价
            /// </summary>
            public const string SPRICE = "SPRICE";
            /// <summary>
            /// 几天后回访
            /// </summary>
            public const string STIMESPAN = "STIMESPAN";
            /// <summary>
            /// 服务项目状态，COA表示激活状态，COS表示停用状态
            /// </summary>
            public const string STATE = "STATE";
            /// <summary>
            /// 是否需要回访
            /// </summary>
            public const string SCALLBACKFLAG = "SCALLBACKFLAG";
            /// <summary>
            /// 几天后回访
            /// </summary>
            public const string SCALLBACKDAY = "SCALLBACKDAY";
            /// <summary>
            /// 服务项目有效期开始时间
            /// </summary>
            public const string STARTDATE = "STARTDATE";
            /// <summary>
            /// 服务项目有效期结束时间
            /// </summary>
            public const string SENDDATE = "SENDDATE";
            /// <summary>
            /// 备注
            /// </summary>
            public const string SREMARK = "SREMARK";
            /// <summary>
            /// 有效服务天数 -1 为永久有效 否则就是第一次护理开始计算加当前的天数即时服务有效期
            /// </summary>
            public const string SAVAILABLEDAYS = "SAVAILABLEDAYS";
            /// <summary>
            /// 快读定位码
            /// </summary>
            public const string SINDEXCODE = "SINDEXCODE";
            /// <summary>
            /// 服务项目编码
            /// </summary>
            public const string SERVICEITEMCODE = "SERVICEITEMCODE";

            /// <summary>
            /// 服务次数
            /// </summary>
            public const string SCOUNT = "SCOUNT";
        }
        /// <summary>
        /// 服务项目状态，COA表示激活状态，COS表示停用状态
        /// </summary>
        public static class ENUM_STATE
        {
            /// <summary>
            /// COA表示激活状态
            /// </summary>
            public const string C0A = "C0A";
            /// <summary>
            /// COS表示停用状态
            /// </summary>
            public const string C0S = "C0S";
            /// <summary>
            /// COA表示 有效
            /// </summary>
            public const string C0A_CHINESE = "有效";
            /// <summary>
            /// COS表示 停用
            /// </summary>
            public const string C0S_CHINESE = "停用";

            /// <summary>
            /// 根据枚举值返回中文
            /// </summary>
            /// <param name="cState">枚举值</param>
            /// <returns>返回中文</returns>
            public static string EnumStrToChineseStr(string cState)
            {
                string[] serchStr = new string[] { C0A, C0S};
                string[] sReturnStr = new string[] { C0A_CHINESE, C0S_CHINESE };
                return DBEntityBase.GetStrReturnStr(cState, serchStr, sReturnStr);
            }
            /// <summary>
            /// 根据中文返回枚举值
            /// </summary>
            /// <param name="chineseStr">中文</param>
            /// <returns>返回枚举字符串</returns>
            public static string ChineseStrToEnumStr(string chineseStr)
            {
                string[] serchStr = new string[] { C0A_CHINESE, C0S_CHINESE };
                string[] sReturnStr = new string[] { C0A, C0S };
                return DBEntityBase.GetStrReturnStr(chineseStr, serchStr, sReturnStr);
            }
        }
    }
}
